<?php
namespace app\payclass\controller;
use app\AdminRest;

use think\App;

use app\payclass\model\Banner as model;

use think\facade\Db;


class AdminBanner extends AdminRest
{

    protected $model;

    public function __construct(App $app) {

        parent::__construct($app);

        $this->model = new Model();

    }


    /**
     * @author chenniang
     * @DataTime: 2020-09-29 11:35
     * @功能说明:列表
     */
    public function bannerList(){

        $input = $this->_param;

        $dis[] = ['status','>',-1];

        $dis[] = ['uniacid','=',$this->_uniacid];

        if(!empty($input['title'])){

            $dis[] = ['title','like','%'.$input['title'].'%'];
        }

        $data = $this->model->bannerList($dis,$input['limit']);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-10-09 11:01
     * @功能说明:添加分类
     */
    public function bannerAdd(){

        $input = $this->_input;

        $input['uniacid'] = $this->_uniacid;

        $res = $this->model->bannerAdd($input);

        return $this->success($res);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-09-29 13:28
     * @功能说明:详情
     */
    public function bannerInfo(){

        $input = $this->_param;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->model->bannerInfo($dis);

        return $this->success($data);

    }


    /**
     * @author chenniang
     * @DataTime: 2020-09-29 13:29
     * @功能说明:编辑
     */
    public function bannerUpdate(){

        $input = $this->_input;

        $dis = [

            'id' => $input['id']
        ];

        $data = $this->model->bannerUpdate($dis,$input);

        return $this->success($data);

    }









}
